Add a patch to put more information in the log if tests fail, in an attempt to debug...
authorSimon McVittie <smcv@debian.org>
Sun, 17 Apr 2016 08:59:23 +0000 (09:59 +0100)
committerSimon McVittie <smcv@debian.org>
Sun, 17 Apr 2016 08:59:23 +0000 (09:59 +0100)
debian/changelog
debian/patches/libtest-show-files-contents-when-assertions-about-them-fa.patch [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]

index a40c693139b81466483f4294eeaa3fbdeebf1c11..53c8611755f1273d1e38ff0d2eb2d802372bef9a 100644 (file)
@@ -19,6 +19,9 @@ ostree (2016.5-1) UNRELEASED; urgency=medium
   * Run dh_auto_test with VERBOSE=1, to get logs with older debhelper
   * Build-depend on elfutils, for test-abi.sh
   * Work around #821235 to avoid undefined macro 'AQ' in some man pages
+  * Add a patch to put more information in the log if tests fail,
+    in an attempt to debug a failure in test/pull-resume.sh which
+    I can no longer reproduce
 
  -- Simon McVittie <smcv@debian.org>  Mon, 28 Mar 2016 12:02:59 +0100
 
diff --git a/debian/patches/libtest-show-files-contents-when-assertions-about-them-fa.patch b/debian/patches/libtest-show-files-contents-when-assertions-about-them-fa.patch
new file mode 100644 (file)
index 0000000..0019f70
--- /dev/null
@@ -0,0 +1,59 @@
+From: Simon McVittie <smcv@debian.org>
+Date: Sun, 17 Apr 2016 09:57:06 +0100
+Subject: libtest: show files' contents when assertions about them fail
+
+I've seen an intermittent test failure in an autobuilder (sbuild)
+environment where logs from failed builds cannot be retrieved,
+but I can no longer reproduce it. Put the contents of the offending
+file in the test's failing output so that if the failure comes back,
+it can be debugged.
+
+Signed-off-by: Simon McVittie <smcv@debian.org>
+---
+ tests/libtest.sh | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/tests/libtest.sh b/tests/libtest.sh
+index 572f023..afdf364 100755
+--- a/tests/libtest.sh
++++ b/tests/libtest.sh
+@@ -100,13 +100,17 @@ assert_has_dir () {
+ assert_not_has_file () {
+     if test -f "$1"; then
+-      echo 1>&2 "File '$1' exists"; exit 1
++        sed -e 's/^/# /' < "$1" >&2
++        echo 1>&2 "File '$1' exists"
++        exit 1
+     fi
+ }
+ assert_not_file_has_content () {
+     if grep -q -e "$2" "$1"; then
+-      echo 1>&2 "File '$1' incorrectly matches regexp '$2'"; exit 1
++        sed -e 's/^/# /' < "$1" >&2
++        echo 1>&2 "File '$1' incorrectly matches regexp '$2'"
++        exit 1
+     fi
+ }
+@@ -118,13 +122,17 @@ assert_not_has_dir () {
+ assert_file_has_content () {
+     if ! grep -q -e "$2" "$1"; then
+-      echo 1>&2 "File '$1' doesn't match regexp '$2'"; exit 1
++        sed -e 's/^/# /' < "$1" >&2
++        echo 1>&2 "File '$1' doesn't match regexp '$2'"
++        exit 1
+     fi
+ }
+ assert_file_empty() {
+     if test -s "$1"; then
+-      echo 1>&2 "File '$1' is not empty"; exit 1
++        sed -e 's/^/# /' < "$1" >&2
++        echo 1>&2 "File '$1' is not empty"
++        exit 1
+     fi
+ }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..bccdff5
--- /dev/null
@@ -0,0 +1 @@
+libtest-show-files-contents-when-assertions-about-them-fa.patch